package cn.js.sangu.unitStore.entity;

import cn.hutool.core.annotation.Alias;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("process_node_template")
public class ProcessNodeTemplate {

    @TableId(type = IdType.AUTO)
    private Integer id;

    @Alias("流程模板名称")
    private String templateName;

    @Alias("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date creatTime;

    @Alias("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date updateTime;

    @Alias("备注")
    private String remark;

    @Alias("创建人id")
    private Integer userId;

    @Alias("创建人名称")
    @TableField(exist = false)
    private String username;

    @Alias("修改人ID")
    private Integer modifier;

    @Alias("修改人名称")
    @TableField(exist = false)
    private String modifierName;

    @Alias("状态")
    private Integer state;

    @Alias("有子数据")
    private Boolean hasChildren;

    @Alias("子数据")
    @TableField(exist = false)
    private List<ProcessNode> children;

}
